-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bevy_reflect: Disambiguate type bounds in where clauses. #8761
bevy_reflect: Disambiguate type bounds in where clauses. #8761
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a simple test here to prevent regressions :) I like the change itself though.
How would I go about doing that? I've never made tests for proc-macro output before. EDIT: Question answered on Discord
|
It was accidentally found that rustc is unable to parse certain constructs in `where` clauses properly. bevy_reflect::Reflect's habit of copying and pasting the types in a struct's definition to its where clauses made it very easy to accidentally run into this behaviour - particularly with the construct for<'a> fn(&'a T) -> &'a T: Trait1 + Trait2 which was incorrectly parsed as for<'a> (fn(&'a T) -> &'a T: Trait1 + Trait2) instead of (for<'a> fn(&'a T) -> &'a T): Trait1 + Trait2 This commit fixes the issue by inserting explicit parentheses to disambiguate types from their bound lists.
Fixed a merge conflict that occurred due to unfortunate timing between my PR and another one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just one comment
Objective
It was accidentally found that rustc is unable to parse certain constructs in
where
clauses properly.bevy_reflect::Reflect
's habit of copying and pasting the field types in a type's definition to itswhere
clauses made it very easy to accidentally run into this behaviour - particularly with the constructwhich was incorrectly parsed as
instead of
Fixes #8759
Solution
This commit fixes the issue by inserting explicit parentheses to disambiguate types from their bound lists.